/*
 * parameters.h
 *
 *  Created on: 2022.3.2
 *      Author: huan
 */

#ifndef SW_CPU0_PARAMETERS_H_
#define SW_CPU0_PARAMETERS_H_

#include <imu.h>
#include <pid.h>
#define USE_EXTERAL_FLASH

union Parame_FLAG_t
{
    uint32_t Pflags;
    struct
    {
        uint32_t PID_PSflag   :1;
        uint32_t Clib_PSflag  :1;
        uint32_t reserve2_flag:1;
        uint32_t reserve7_flag:1;
        uint32_t reserve3_flag:1;
        uint32_t reserve4_flag:1;
        uint32_t reserve5_flag:1;
        uint32_t reserve6_flag:1;
    };
};
extern union Parame_FLAG_t Parame_FLAG;

union Parame_PID_t
{
    struct
    {
        float kp_[Pid_Num];
        float ki_[Pid_Num];
        float kd_[Pid_Num];
    };
    float  byte[156];
};
extern union Parame_PID_t Parame_PID;

union Parame_Clib_t
{
    struct
    {
        Axis3f      acce;
        uint32_t    acceState;
        Axis3f      gyro;
        uint32_t    gyroState;
    };
    float  byte[8];
};
extern union Parame_Clib_t Parame_Clib;

typedef enum
{
    PID_sector = 0,
    Clibration_sector,

    Sector_num
}Flash_sector;
typedef struct
{
    int16_t (*saveData)(Flash_sector sector_num);
    int16_t (*readData)(Flash_sector sector_num);
}Parameter_HandleTypedef;


void Parame_Task(void* parameter);
#endif /* SW_CPU0_PARAMETERS_H_ */
